import { refreshTokenApi } from "@/api/login";
import { useUserStoreWithOut } from "@/store/modules/user";

// 刷新token
export const useReflesh = async () => {
  const userStore = useUserStoreWithOut();
  try {
    const refreshRes = await refreshTokenApi();
    // const access_token = refreshRes.config.data.refresh_token;
    if (refreshRes) {
      userStore.setAccessToken(refreshRes);
    }  
    return true
  } catch {
    return Promise.reject();
  }
};